<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>常用对象-数组和字符串</title>
</head>
<body>

<div>

    ddd

</div>
<a href="" id="" name=""></a>
</body>
<script>
    /**
     *  数组 ：
     *  1. 变异操作  push-pop unshift-shift
     *  2. 非变异操作 find-filter map-reduce
     *              concat join  reverse sort
     * */

    var arr = [1,3,5,7];
    var arr2=[2,4,6];

    var newArr = arr.concat(arr2);

    console.log(newArr);
    console.log(arr);

    var res= arr.join('-');
    console.log(res);
    console.log(arr);

    /**
     *  字符串：
     *    不可变
     *    contact
     * */

    var message='hello';
    //message+=' world';

    /* 链式操作  函数化编程 */
    message
            .concat(' world')
            .concat(' test');

    var year = 2024;
    var month=3;
    var ddate = 15;

  var myDate =  year
        .toString()
        .concat('-')
        .concat(month)
        .concat('-')
        .concat(ddate);

    var myDates=[];
      myDates.push(year);
      myDates.push(month);
      myDates.push(ddate);

      var myDate2= myDates.join('-');

    alert(myDate2);

</script>
</html>